﻿@{
    ViewBag.Title = "ChangePwdWindow";
}
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>修改密码</title>
</head>
<body>
    <form id="form1">
        <div class="dialog-content">
            <ul>
                <li>
                    原   密   码：<input id="txtPassword" name="pwd" class="easyui-validatebox" data-options="required:true" type="password" style="width: 150px" />
                </li>
                <li>
                    新   密   码：<input id="txtNewPassword" name="pwd1" class="easyui-validatebox" data-options="required:true" type="password" style="width: 150px" />
                </li>
                <li>
                    重复密码：<input class="easyui-validatebox" name="pwd2" id="txtNewPassword2" type="password" data-options="required:true" style="width: 150px" validtype="equalTo['#txtNewPassword']" />
                </li>
            </ul>
        </div>
        <div class="dialog-bottom">
            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" onclick="changePwd.Confirm()">确定</a>
            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="changePwd.Cancel()">取消</a>
        </div>
    </form>
    <script type="text/javascript">
        var changePwd = {};
        changePwd.Cancel = function () {
            $("#divChangePwd").dialog('close');
        }
        changePwd.Confirm = function () {
            if ($("#form1").form("validate")) {
                com.ajax({
                    type: "POST",
                    url: "/BD/User/ChangePwd",
                    data: { oldpwd: $('#txtPassword').val(), newpwd: $('#txtNewPassword').val()},
                    success: function (data) {
                        if (data.state == "error")
                        {
                            com.message("information", data.msg);
                        }
                        else
                        {
                            com.message("information", data.msg);
                            $("#divChangePwd").dialog('close');
                        }
                    }
                });
            }
        }
    </script>
</body>
</html>

